package com.example.sherlockzhong.plush_v2.Components.buttons;

/*
 * Created by DosonLeung on 2014/8/26.
 */

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class AddOrgButton extends BasicButton {
    private Activity app;

    public AddOrgButton(Context context) {
        super(context);
    }

    public AddOrgButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public Activity getApp() {
        return app;
    }

    public void setApp(Activity app) {
        this.app = app;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        ButtonMotionEvent(ev);
        return true;
    }

    public void ButtonMotionEvent(MotionEvent ev) {
        int action = ev.getAction();
        switch (action) {
            case MotionEvent.ACTION_DOWN:
                break;
            case MotionEvent.ACTION_UP:
                preActivity();
                break;
            case MotionEvent.ACTION_MOVE:
                break;
            case MotionEvent.ACTION_CANCEL:
                break;
            default:
                break;
        }
    }

    private void preActivity() {
        app.finish();
    }
}
